<?php

namespace app\service;

use app\model\VirtualDeviceDetailModel;
use share\service\BaseModelService;

class VirtualDeviceDetailService extends BaseModelService
{
    public static function getModel()
    {
        return new VirtualDeviceDetailModel();
    }

    public static function getAllByUserDevice($uid, $virtualDeviceIds)
    {
        $model = self::getModel();
        $data =  $model->where([
            'uid' => $uid,
            'virtual_device_id' => ['in', $virtualDeviceIds]
        ])->order('id', 'ASC')->select();
        return $model::formatCollectionData($data);
    }

    public static function getAllByUserMainDevice($uid, $virtualDeviceId)
    {
        $model = self::getModel();
        $data =  $model->where([
            'uid' => $uid,
            'virtual_device_id' => $virtualDeviceId,
        ])->order('id', 'ASC')->select();
        return $model::formatCollectionData($data);
    }
}
